package gradledemo;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.DecimalFormat;
public class TelFee {
    public double calculate(String sd1, String sd2, int xia) {

        double telFee;
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));//字符输入流

        HoldingTime ht = new HoldingTime(sd1,sd2);

        System.out.println("电话接通时间："+ht.DateFormate(ht.startT));
        System.out.println("电话结束时间："+ht.DateFormate(ht.endT));

        DecimalFormat    df   = new DecimalFormat("######0.00");
        long minute = ht.getHoldingTime();
        //计算话费
        if(minute <= 20){
            telFee = 0.05*minute;
        }else{
            telFee = 1.00 + (minute - 20)*0.1;
        }
       // System.out.println("通话时间为："+minute+"分钟");
       // System.out.println("本次通话话费为："+df.format(telFee)+"美元");
        return telFee;
    }
}
